1
|
|
|
/** global: navigator */ |
2
|
|
|
|
3
|
|
|
$( document ).ready(function() { |
4
|
|
|
/* |
5
|
|
|
//gets the current date information to be used in the datepicker |
6
|
|
|
var date = new Date(); |
7
|
|
|
var currentMonth = date.getMonth(); |
8
|
|
|
var currentDate = date.getDate(); |
9
|
|
|
var currentYear = date.getFullYear(); |
10
|
|
|
|
11
|
|
|
$( "#start_date" ).datetimepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: new Date(2014, 04 - 1, 12), maxDate: new Date(currentYear, currentMonth, currentDate, 23, 59) }); |
12
|
|
|
$( "#end_date" ).datetimepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: new Date(2014, 04 - 1, 12), maxDate: new Date(currentYear, currentMonth, currentDate, 23, 59) }); |
13
|
|
|
$( "#date" ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: new Date(2014, 04 - 1, 12), maxDate: new Date(currentYear, currentMonth, currentDate) }); |
14
|
|
|
*/ |
15
|
|
|
//custom select boxes |
16
|
|
|
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { |
17
|
|
|
$('.selectpicker').selectpicker('mobile'); |
18
|
|
|
} else { |
19
|
|
|
$('.selectpicker').selectpicker(); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
//search |
23
|
|
|
$("body.page-search .sub-menu input[type=text]").click(function(){ |
24
|
|
|
this.select(); |
25
|
|
|
}); |
26
|
|
|
|
27
|
|
|
//bootstrap popover |
28
|
|
|
$('[data-toggle="popover"]').popover({ |
29
|
|
|
trigger: 'hover', |
30
|
|
|
'placement': 'bottom' |
31
|
|
|
}); |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
}); |
35
|
|
|
|
36
|
|
|
function showSearchContainers(){ |
37
|
|
|
$(".search-explore").hide(); |
38
|
|
|
$(".search-containers").slideDown(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
function showSubMenu(){ |
42
|
|
|
$(".sub-menu-statistic").hide(); |
43
|
|
|
$(".sub-menu-container").slideDown(); |
44
|
|
|
} |
45
|
|
|
function language(selectObj) { |
46
|
|
|
var idx = selectObj.selectedIndex; |
47
|
|
|
var lang = selectObj.options[idx].value; |
48
|
|
|
document.cookie = 'language='+lang+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
49
|
|
|
window.location.reload(); |
50
|
|
|
} |
51
|
|
|
function populate(obj,str,selected) { |
52
|
|
|
//console.log('populate'); |
53
|
|
|
$.ajax({ |
54
|
|
|
url:'search-ajax.php', |
55
|
|
|
type:'GET', |
56
|
|
|
data: 'ask=' + str, |
57
|
|
|
dataType: 'json', |
58
|
|
|
success: function( json ) { |
59
|
|
|
var options = ""; |
60
|
|
|
$.each(json, function(i, item){ |
61
|
|
|
if ($.inArray(item.id,selected) != -1) { |
62
|
|
|
options += "<option value="+item.id+" selected>"+item.value+"</option>"; |
63
|
|
|
} else { |
64
|
|
|
options += "<option value="+item.id+">"+item.value+"</option>"; |
65
|
|
|
} |
66
|
|
|
}); |
67
|
|
|
obj.append(options); |
68
|
|
|
} |
69
|
|
|
}); |
70
|
|
View Code Duplication |
} |
|
|
|
|
71
|
|
|
function statsdatechange(e) { |
|
|
|
|
72
|
|
|
var form = document.getElementById('changedate'); |
73
|
|
|
var yearmonth = form.date.value.split("-"); |
74
|
|
|
var pagename = location.pathname; |
75
|
|
|
pagename = pagename.split('/'); |
76
|
|
|
var i = 0; |
77
|
|
|
var page = ''; |
78
|
|
|
for (i = 0; i < pagename.length; i++) { |
79
|
|
|
if (pagename[i] != '') { |
80
|
|
|
if (isNaN(pagename[i])) page = page +'/'+ pagename[i]; |
|
|
|
|
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
if (typeof yearmonth[1] != 'undefined') { |
84
|
|
|
form.action = page+'/'+yearmonth[0]+'/'+yearmonth[1]; |
85
|
|
|
} else { |
86
|
|
|
form.action = page; |
87
|
|
|
} |
88
|
|
|
form.submit(); |
89
|
|
View Code Duplication |
} |
|
|
|
|
90
|
|
|
function statsairlinechange(e) { |
|
|
|
|
91
|
|
|
var form = document.getElementById('changeairline'); |
92
|
|
|
var airline = form.airline.value; |
93
|
|
|
var pagename = location.pathname; |
94
|
|
|
pagename = pagename.split('/'); |
95
|
|
|
var i = 0; |
96
|
|
|
var page = ''; |
97
|
|
|
var add = false; |
98
|
|
|
for (i = 0; i < pagename.length; i++) { |
99
|
|
|
if (pagename[i] != '') { |
100
|
|
|
if (pagename[i].length != 3) page = page+'/'+pagename[i]; |
|
|
|
|
101
|
|
|
else { |
102
|
|
|
add = true; |
103
|
|
|
if (airline != 'all') page = page+'/'+airline; |
|
|
|
|
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
if (add === false) page = page+'/'+airline; |
|
|
|
|
108
|
|
|
form.action = page; |
109
|
|
|
form.submit(); |
110
|
|
|
} |
111
|
|
|
|